﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace AT.IBMS.Framework.Configuration
{

    /// <summary>
    /// 数据库配置节点。
    /// </summary>
    public class DataElement : ConfigurationElement
    {

        /// <summary>
        /// 默认数据库连接字符串的名称。
        /// </summary>
        [ConfigurationProperty("defaultConnectionStringName", IsRequired = true)]
        public string DefaultConnectionStringName
        {
            get
            {
                return (string)this["defaultConnectionStringName"];
            }
        }

        /// <summary>
        /// 获取默认数据库连接字符串。
        /// </summary>
        public string DefaultConnectionString
        {
            get
            {
                return DefaultConnectionSettings.ConnectionString;
            }
        }

        /// <summary>
        /// 获取默认数据库连接字符串的设置。
        /// </summary>
        public ConnectionStringSettings DefaultConnectionSettings
        {
            get
            {
                return ConfigurationManager.ConnectionStrings[DefaultConnectionStringName];
            }
        }

    }
}
